package plugins

// GetServiceName 根据端口号获取服务名称
func GetServiceName(port int) string {
	// 常见端口服务对照表
	services := map[int]string{
		20:    "FTP-数据",
		21:    "FTP-控制",
		22:    "SSH",
		23:    "Telnet",
		25:    "SMTP",
		53:    "DNS",
		67:    "DHCP-服务器",
		68:    "DHCP-客户端",
		69:    "TFTP",
		80:    "HTTP",
		110:   "POP3",
		119:   "NNTP",
		123:   "NTP",
		137:   "NetBIOS-名称服务",
		138:   "NetBIOS-数据报",
		139:   "NetBIOS-会话",
		143:   "IMAP",
		161:   "SNMP",
		162:   "SNMP-陷阱",
		389:   "LDAP",
		443:   "HTTPS",
		445:   "SMB",
		465:   "SMTPS",
		514:   "Syslog",
		587:   "SMTP(提交)",
		636:   "LDAPS",
		993:   "IMAPS",
		995:   "POP3S",
		1080:  "SOCKS",
		1433:  "MSSQL",
		1434:  "MSSQL-Monitor",
		1521:  "Oracle",
		2181:  "ZooKeeper",
		3306:  "MySQL",
		3389:  "RDP",
		5432:  "PostgreSQL",
		5900:  "VNC",
		5901:  "VNC-1",
		5902:  "VNC-2",
		6379:  "Redis",
		6443:  "Kubernetes API",
		8080:  "HTTP-Alt",
		8443:  "HTTPS-Alt",
		9200:  "Elasticsearch",
		9990:  "JBoss",
		27017: "MongoDB",
	}

	if service, exists := services[port]; exists {
		return service
	}
	return "未知服务"
}
